38b4606a1809f8f2e724a371bc407f479acc93ee,maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java,DefaultModelValidator,validateEnum,#String#ModelProblemCollector#Severity#String#String#String#,617
Before Change
return true;
}
if ( sourceHint != null )
{
addViolation( problems, severity, "'" + fieldName + "' must be one of " + values + " for " + sourceHint
+ " but is '" + string + "'." );
}
else
{
addViolation( problems, severity, "'" + fieldName + "' must be one of " + values + " but is '" + string
+ "'." );
}
return false;
After Change
return false;
}
private boolean validateEnum( String fieldName, ModelProblemCollector problems, Severity severity, String string,
String sourceHint, String... validValues )
{
if ( string == null || string.length() <= 0 )
{
return true;
}
List<String> values = Arrays.asList( validValues );
if ( values.contains( string ) )
{
return true;
}
addViolation( problems, severity, fieldName, sourceHint, "must be one of " + values + " but is '" + string
+ "'." );
return false;
}